package com.macro.mall.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum IdentityEnum {
//    身份 1=人大代表  2=名人   3=群众账号
    DEPUTY( (byte)1, "人大代表"),

    FAMOUS( (byte)2, "名人"),

    GENERAL( (byte)3, "群众账号");

    private final Byte codeNum;

    private final String title;



    public static IdentityEnum of(Byte code) {
        for (IdentityEnum identityEnum : IdentityEnum.values()){
            if(identityEnum.codeNum.equals(code)){
                return identityEnum;
            }
        }
        return GENERAL;
    }

    public static String getTitle(Byte code){
        return of(code).title;
    }

}
